Repository navigation
fix: mount the engine's Docker socket for a TCP host on Windows - #4119
fiodortretyakov wants to merge 3 commits into
Conversation
On Windows, DockerSocketPath holds the client's default named pipe, so a tcp:// Docker host made Ryuk mount //./pipe/docker_engine and fail. Use the //var/run/docker.sock UNC path there, as the Docker Desktop branch already does. Linux and macOS are unchanged.
👷 Deploy request for testcontainers-go pending review.Visit the deploys page to approve it
|
|
No actionable comments were generated in the recent review. Summary by CodeRabbit
WalkthroughTCP Docker hosts now use the Windows socket path on Windows and the standard socket path on other platforms. Tests and configuration documentation describe these platform-specific paths. ChangesDocker socket path selection
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested labels: Suggested reviewers: Merge Risk:
|
|
Reminder: review, Windows TCP host, Ryuk socket mount, mergeable |
mdelapenya
left a comment
There was a problem hiding this comment.
LGTM, thanks for the regression test!
NIT: I'd rename the new subtest to windows-tcp-host to follow our preference for names without spaces?
We’ll wait for CI before merging.
🤖 Written assisted by my Codex
|
Renamed the subtest to |
I merged with main so that it gets the Chroma fixes from #4130 |
What does this PR do?
When the Docker host is a
tcp://endpoint and the client runs on Windows,extractDockerSocketFromClientreturnsDockerSocketPath. On Windows that variable holds the Docker client's default named pipe (//./pipe/docker_engine, set ininit()fromclient.DefaultDockerHost), so Ryuk gets the pipe path as its bind mount source.This PR returns
WindowsDockerSocketPath(//var/run/docker.sock) for a TCP host on Windows, the same value the Docker Desktop branch already uses. Everything else keepsDockerSocketPath, so nothing changes on Linux and macOS.internal/core/docker_host.go: the TCP case incheckDockerSocketFn.internal/core/docker_host_test.go: the TCP expectations now depend on the platform, and a new subtest emulates a Windows client (GOOS=windowsand a named-pipeDockerSocketPath). It fails without the fix.docs/features/configuration.md: rules 1 and 6 mention the Windows path.Why is it important?
On a Windows machine that talks to a Linux engine over TCP (in my case dockerd in WSL on
tcp://localhost:2376with TLS, no Docker Desktop), the engine receives//./pipe/docker_engineas the bind source, creates it as an empty directory, and Ryuk exits right away. With current main,Runfails after about 20 seconds withreaper: new reaper: run container: started hook: wait until ready: container state: removing: could not start container, after creating 14 Ryuk containers. With v0.44 it waited 60 seconds and left the target container behind in the created state. The only workaround isTESTCONTAINERS_DOCKER_SOCKET_OVERRIDEin every project.Testcontainers for Java already mounts
//var/run/docker.sockfor a TCP host on Windows (DockerClientFactory.getRemoteDockerUnixSocketPath).Related issues
How to test this PR
go test ./internal/core/ -run TestExtractDockerSocketFromClient. On main, the new subtest fails on Linux withactual: "//./pipe/docker_engine".DOCKER_HOST=tcp://...pointing to a Linux engine and no override, start any container with Ryuk enabled. Before: the error above. After:Resolved Docker Socket Path: //var/run/docker.sock, one Ryuk container, and my test container was ready after 1.3 seconds.